package 程序员面试金典;

import java.util.LinkedList;
import java.util.List;

public class StreamRank {

    List<Integer> list;
    public StreamRank() {
       list = new LinkedList<Integer>();
    }

    public void track(int x) {
        list.add(x);
    }

    public int getRankOfNumber(int x) {
        int res=0;
        for (Integer integer : list) {
            if (integer<=x)
                res++;
        }
        return res;
    }
}
